<script setup lang="ts">
const props = defineProps<{ user: AdminActionUser }>();

const emit = defineEmits(["ok"]);

const { $post } = use$fetch();

const handleApi = async () => {
  await $post<AffResp>(`/admin/user/active`, { id: props.user.id }, (v) => {
    emit("ok");
    return v;
  });
};
</script>

<template>
  <ConfirmDialog @ok="handleApi">
    <template #title>通过用户审核</template>

    <div class="mt-8">
      确定通过用户<span
        class="text-yellow-700 p-1 bg-yellow-50 rounded mx-1 border border-yellow-200"
        >{{ user.email }}</span
      >审核吗？
    </div>
  </ConfirmDialog>
</template>
